cssprovider: Emit a g_warning() when a css file is erroneous
authorBenjamin Otte <otte@redhat.com>
Sun, 10 Apr 2011 23:51:49 +0000 (01:51 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 18 May 2011 19:58:45 +0000 (21:58 +0200)
... and no other error handler is active. See the source code comment
for the reasoning.

gtk/gtkcssprovider.c

index 4a3b833d52588598bac5122890c06594a4f1a62b..9e6d3c85729d0a9ecfcede8325019d62f59d3e57 100644 (file)
@@ -876,6 +876,20 @@ gtk_css_provider_parsing_error (GtkCssProvider  *provider,
       priv->error = g_error_copy (error);
       g_prefix_error (&priv->error, "%s:%u:%u: ", path ? path : "<unknown>", line, position);
     }
+
+  /* Only emit a warning when we have no error handlers. This is our
+   * default handlers. And in this case erroneous CSS files are a bug
+   * and should be fixed.
+   * Note that these warnings can also be triggered by a broken theme
+   * that people installed from some weird location on the internets.
+   */
+  if (!g_signal_has_handler_pending (provider,
+                                     css_provider_signals[PARSING_ERROR],
+                                     0,
+                                     TRUE))
+    {
+      g_warning ("Theme parsing error: %s:%u:%u: %s", path ? path : "<unknown>", line, position, error->message);
+    }
 }
 
 static void